package chatInterface;

import gui.Message;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.Map;

import server.NodeRecord;


public interface Interface extends Remote {
		// Metody slouzici k navazani spojeni
		public String hello()throws RemoteException;
		public boolean connectToServer(String name, String ip, int port)throws RemoteException;
		public boolean connectToLeader(String name, String ip, int port)throws RemoteException;
		public void createLocalClient()throws RemoteException;
		public boolean updateMyMap(NodeRecord node, int command)throws RemoteException;
		public void updateMyAllMap(Map<String, NodeRecord> records)throws RemoteException;
		public void prepareForLeader(String name,int idl,int fin) throws RemoteException;
		public NodeRecord whatIsYourBuddy(String name)throws RemoteException;
		public void receiveLeader(NodeRecord node)throws RemoteException;
		public void newNodeForLeader(NodeRecord node, String name,int command)throws RemoteException;
		public void whereIsRingBroken(String name, int whereBroke)throws RemoteException;
		 public void prepareNextHops() throws RemoteException;
		 public void updateNextHops()throws RemoteException;
		//metoda na zaslani informaci pripojovacimu k navazani do kruhu
		public void sendBuddy(NodeRecord node)throws  RemoteException;
		public void youAreMyAgent(String name)throws RemoteException;
		public void leaderIsDeath()throws RemoteException;
		//metoda na odpojeni uzlu
		public void disconnectMe(String myname, NodeRecord node)throws  RemoteException;
		
		//Interfaci k LEADrovi NEZAPOJENO Zacatek
		public void initOfLead()throws  RemoteException;
		public void processCandidatire(int j, int lr, int Lmaxr, String name)throws  RemoteException;
		public void prepareForComunication(int numNodes, int myID, String myName, Map<String, NodeRecord> records)throws RemoteException;
		public void receivedResponse(boolean r, int j, String name)throws RemoteException;
		public void receivedElected (int j, String name)throws RemoteException;
		//Interfaci k LEADrovi NEZAPOJENO Konec
	
		// Medoda pro posilani zprav od leadera
		public boolean sendMessage(Message msg) throws RemoteException;	
		// Metoda pro posilani zprav leaderovi
		public boolean sendMessageToLeader(Message msg) throws RemoteException;
}


